<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div id="main_AssoWo_list" class="easyui-layout" fit="true">
    <div region="center" style="padding:0px;border:0px">
        <table style="width: 100%;" cellpadding="0" cellspacing="1"  border="0" class="formtable" align="center">
	       <tr height="40" >
				<td>
				    <label style="padding:2px;"> 工单来源  </label>
				    <select name="woSrc" id="woSrc" style="margin-left:5px;width:120px;" >
					         <option value="">请选择</option>			                                 
					         <option value="A01">95598工单</option>
                              <option value="A02">增值服务</option>
				    </select>
				    <select name="pmd" id="pmd" style="width:90px;">	
				         <option value="customerNo">客户编号</option>
				         <option value="contactPhone">联系电话</option>
				         <option value="id">工单编号</option>	
				         <option value="createRealname">办理人员</option>
			        </select>
			        <input type="text" name="pmv" id="pmv" style="width:150px;">
			                   
			        <label style="padding:2px;"> 工单状态   </label>
			        <t:dictSelect field="woState" id="woState" typeGroupCode="woState" hasLabel="false" defaultVal="" ></t:dictSelect>
			       
			       
	                
	                <a href="#" class="easyui-linkbutton"  plain="true" iconCls="icon-search"  style="margin-left:5px;" onclick="myquery();" >查 询</a>
				</td>
				
			</tr>
		 </table>
		<div region="center" style="padding:0px;border:0px;height:460px;width:980px;">
	        <t:datagrid name="assoWoList" title="工单列表"
	                    actionUrl="woController.do?synQueryListGrid" checkbox="true"
	                   treegrid="false"   idField="id" pagination="true" sortOrder="desc" sortName="createDatetime" onLoadSuccess="" pageSize="10">
	            <t:dgCol title="" field="checked" ></t:dgCol>
	            <t:dgCol title="工单来源" field="woSrcDesc" width="60" ></t:dgCol>
	            <t:dgCol title="编号" field="id" width="60" hidden="true"></t:dgCol>
	            <t:dgCol title="工单编号" field="wo95598Id" width="90" ></t:dgCol>
		        <t:dgCol title="客户名称 " field="customerName" width="120" ></t:dgCol>
		        <t:dgCol title="联系电话 " field="contactPhone" width="80" ></t:dgCol>
		        <t:dgCol title="工单状态" field="woStateDesc" width="50" ></t:dgCol>
		        <t:dgCol title="受理人员" field="createRealname" width="50" ></t:dgCol>
		        <t:dgCol title="受理时间 " field="createDatetime"  width="80" formatter="yyyy.MM.dd hh:mm:ss"></t:dgCol>
		        <t:dgCol title="common.operation" field="opt" width="60"></t:dgCol>
	            <t:dgFunOpt funname="showWoDetail(id)" title="工单详情"></t:dgFunOpt>
	        </t:datagrid>
        </div>
    </div>
</div>


<div style="display: none">
    <t:formvalid formid="formobj" layout="div" dialog="true" action="woController.do?doAddAssoWo&wo_id=${wo_id}" beforeSubmit="setAssoWoIds();">
        <input id="asWoIds" name="asWoIds">
        
    </t:formvalid>
</div>

<script type="text/javascript">
	
    function showWoDetail(id){
	  createdetailwindow(id+"工单详情","woController.do?woDetail&wo_id=" + id,1200,600);
		 
    }
    
    function checkSelected(data){
    	if(data){
    		$.each(data.rows, function(index, item){
    			console.log(item.id);
	    		if(item.checked){
	    		   $('#dg').datagrid('checkRow', index);
	    		}
    		});
    	}
    }
	
	function myquery(){
		 //字段选项
	    var pmd = $('#pmd').val();
		 //字段值
	    var pmv = $('#pmv').val();
		 //工单状态
	    var woState = $('#woState').val();
	    //工单来源
	    var woSrc = $('#woSrc').val();
		
		$('#synQueryList').datagrid({
			queryParams: {
				pmd: pmd,
				pmv: pmv,
				woState: woState,
				woSrc: woSrc
			}
		});

	}
 
    function setAssoWoIds() {
    	var asWoIds = getWoListSelections('id');
 
    	if(asWoIds==''){
    		$.messager.alert('&nbsp;&nbsp;信息提醒','请至少选择一条记录！', 'info');
    		return false;
    	}
        $("#asWoIds").val(asWoIds);
        return true;
    }

    function getWoListSelections(field) {
        var ids = [];
        var rows = $('#assoWoList').datagrid('getSelections');
        for (var i = 0; i < rows.length; i++) {
            ids.push(rows[i][field]);
        }
        ids.join(',');
        return ids
    }
	
</script>